<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="perm" uri="/WEB-INF/tld/perm.tld"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<html>
<script>
	var ctx = "${ctx}";
</script>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>专场管理</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
	<meta http-equiv="expires" content="Wed, 26 Feb 209908:21:57 GMT"> 
	
	<link href="${ctx}/static/css/bootstrap.min.css?v=${static_version}" rel="stylesheet" />
	<link href="${ctx}/static/css/font-awesome.min.css?v=4.4.0?v=${static_version}" rel="stylesheet" />
	<link href="${ctx}/static/css/animate.min.css?v=${static_version}" rel="stylesheet" />
	<link href="${ctx}/static/css/style.min.css?v=${static_version}" rel="stylesheet" />
	<link href="${ctx}/static/css/common.css?v=${static_version}" rel="stylesheet" />
	<link href="//at.alicdn.com/t/font_9x03jhokyws9vn29.css" rel="stylesheet">
	
	<!-- Data Tables -->
	<link href="${ctx}/static/css/plugins/dataTables/dataTables.bootstrap.css?v=${static_version}" rel="stylesheet" />
	<style type="text/css">
	
	</style>    
</head>
<body class="gray-bg">

	<div class="wrapper wrapper-content  animated fadeInRight">
			<div class="ibox float-e-margins">
								
        		<!-- 专场列表 -->
                <div class="ibox-title clearfix">
                    <h5>专场列表<small></small></h5>
                      <div  style="float:right">
							<button name="" id="" class="btn btn-primary radius" onclick="javascript:location.replace(location.href);" type="submit">刷新</button>	
		</div>
                </div>
                
				<div class="ibox-content">
				
					<div class="row" >	
					<form action="${ctx}/seller/speChangList" method="get" class="form form-horizontal" id="search-form"	onsubmit="beforSubmit()">
				
					<div class="col-md-3">
						<label class="col-sm-5 control-label">专场名称</label>
						<div class="col-sm-7">
							<input type="text" name="scName" value=""
								id="name" placeholder="商品名称或ID" class="form-control">
						</div>
					</div>
					<div class="col-md-3">
					<label class="col-sm-5 control-label">分类名称</label>
					<div class="col-sm-7">
						<span class="select-box"> <select class="input-md form-control chosen-select"
							name="type" id="type">
								<option value="-1">--请选择--</option>
								<c:forEach items="${types}" var="type">
									<option value="${type.C_CODE}">${type.C_NAME}</option>
								</c:forEach>
						</select>
						</span>
					</div>
						</div>
				<div class="col-md-3">
					<label class="col-sm-5 control-label">状态</label>
					<div class="col-sm-7">
						<span class="select-box"> <select class="input-md form-control chosen-select"
							name="status" id="type">
								<option value="-1">--请选择--</option>
								<option value="0">即将开始</option>
								<option value="1">进行中</option>
								<option value="2">已结束</option>
							</select>
						</span>
					</div>
						</div>
					<div class="col-md-3">
						<button name="" id="" class="btn btn-primary" type="submit"> 查询</button>
					</div>						
			</form>
			</div>
			
            <div class="hr-line-dashed3"></div> 
             
			<table
				class="table table-border table-bordered table-hover table-bg table-sort">
				<thead>
					<tr class="ibox-content">
						<th class="text-center" width="80">专场名称</th>
						<th class="text-center">分类</th>
						<th class="text-center">图片</th>
						<th class="text-center">专场时间</th>
						<th width="100"  class="text-center">商品数</th>
						<th width="120"  class="text-center">状态</th>
						<th width="300"  class="text-center">操作</th>
					</tr>
				</thead>
				<tbody>
					<c:choose>
						<c:when test="${empty list}">
							<tr class="ibox-content">
								<td colspan="7">暂无数据</td>
							</tr>
						</c:when>
						<c:otherwise>
							<c:forEach items="${list}" var="var">
								<tr class="ibox-content">
									<td>${var.title}<input type="hidden" id="sc_id" name="sc_id" value='${var.topic_id}' /></td> 
								<td  class="text-center">
								<c:forEach items="${types}" var="type">
								<c:if test="${type.C_CODE==var.type_id}">
									${type.C_NAME}
								</c:if>
								</c:forEach>
								</td>
									
									<td class="text-center"><img src="${var.topic_img}"  style="height:30px"/></td>
									<td class="text-center">${var.start_date} ${var.start_time}-${var.end_time}</td>
									<td class="text-center">${var.numx}<input type="hidden" value='${var.topic_id}' /></td>
									<td class="text-center"><c:choose>
											<c:when test="${var.statusTip==1}">
									<span class="btn btn-primary-line  btn-xs btn-line">进行中</span>
											</c:when>
											<c:when test="${var.statusTip==2}">
									<span class="btn btn-default-line btn-xs btn-line">已结束</span>
											</c:when>
											<c:when test="${var.statusTip==0}">
									<span class="btn btn-warning-line btn-xs btn-line">即将开始</span>
											</c:when>
											<c:otherwise>
									<span class="btn btn-default-line btn-xs btn-line">未知</span>
											</c:otherwise>
										</c:choose>
									</td>
									
									<td class="td-manage text-center">
									 <button onClick="t_sp_add('添加商品','${ctx}/seller/speChangForDialog?typeId=${var.type_id }&topicId=${var.topic_id }',600,500)" href="javascript:void(0);" class="btn btn-primary " type="button">添加商品</button>
<!--									 <i class="fa fa-check" title="添加"></i>&nbsp;-->
										&nbsp;&nbsp;
									 <button onClick="t_sp_edit('编辑','${var.topic_id}','edit')" href="javascript:void(0);" class="btn btn-info " type="button"> 编辑</button>
<!--									 <i class="fa fa-paste"></i>-->
										&nbsp;&nbsp;
									<button  onClick="t_sp_delete(this,'${var.topic_id}')" class="btn btn-warning " type="button"><span class="bold">删除</span>
<!--                                   <i class="fa fa-warning"></i> -->
                                    </button>
										</td>
								</tr> 
							</c:forEach>
						</c:otherwise>
					</c:choose>

				</tbody>
			</table>
			
			</div>
	</div>
</div>
	
	<script src="${ctx}/static/js/jquery.min.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/bootstrap.min.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/plugins/layer/layer.js?v=${static_version}"></script>
    <script src="${ctx}/static/js/plugins/webuploader/webuploader.min.js"></script>
   <script
		src="${ctx}/static/js/plugins/dataTables/jquery.dataTables.js?v=${static_version}"></script>
	<script
		src="${ctx}/static/js/plugins/dataTables/dataTables.bootstrap.js?v=${static_version}"></script>
	<script type="text/javascript">
		$(document).ready(function() {
			$(".table-sort").dataTable();
		});
	
		/*添加*/
		function t_sp_add(title,url){
			var index = layer.open({
				type: 2,
				title: title,
				content: url
			});
			layer.full(index);
		} 
		
		/*编辑*/
		function t_sp_edit(obj,id,w,h){
			var edit_page = "${ctx}/seller/goSpeicalChangEdit?topicId="+id;
			var index = layer.open({
				type: 2,
				title: "编辑",
				content: edit_page
			});
			layer.full(index);
		}

		/*删除*/
		function t_sp_delete(obj,id){
			layer.confirm('确认删除？', {
				btn: ['确认','取消'], 
				shade: false
			},
			function(){
				$.ajax({
					type : "POST",
					url : "${ctx}/seller/delSpecailChangById",
					data : "id=" + id,
					error : function() {
						layer.msg('操作失败', {
							icon : 5,
							time : 1000
						});
					},
					success : function(msg) {
						layer.msg('已删除 ' + msg.information, {
							icon : 6,
							time : 1000
						});
						location.reload()
					}
				});
			}, function() {
				layer.msg('未删除', {
					icon : 5,
					time : 1000
				});
			});
		}	
	</script>

</body>
</html>



